package lib.bone.flow.service;

import lib.bone.common.core.domain.ResponseDTO;
import lib.bone.flow.domain.entity.FlowWork;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Optional;

public interface FlowWorkService {



    /**
     * 获取全部 -- 推荐使用 getAllFlowWork(Example e)
     * @return
     */
    List<FlowWork> getAllFlowWork();

    /**
     * 获取全部 -- 推荐使用 getAllFlowWork(Example e)
     * @return
     */
    Optional<FlowWork> getByServiceId(String id);

    /**
     * 获取符合条件的全部流程实例
     * @param example
     * @return
     */
    List<FlowWork> getAllFlowWork(Example<FlowWork> example);

    /**
     * 根据ID列表获取流程实例信息
     * @param flowWorkIds
     * @return
     */
    List<FlowWork> getFlowWorksByIds(List<String> flowWorkIds);

    /**
     * 构建服务名
     */
    void buildService(FlowWork flowWork);

    /**
     * 构建周期
     * @param flowWork
     */
    void buildCycle(FlowWork flowWork,String cycleId,String cycleName);

    /**
     * 删除一个流程实例
     */
    void deleteFlow(String flowWorkId);

    /**
     * 存储一个实例
     */
    FlowWork saveOne(FlowWork flowWork);

    /**
     * 获取一个流程实例
     */
    Optional<FlowWork> getById(String flowWorkId);
    /**
     * 更新流程实例
     */
    public ResponseDTO<FlowWork> updateWork(FlowWork flowWork);
    /**
     * 批量查询流程实例
     */
    public ResponseDTO getAll(Pageable pageable, Example<FlowWork> example);

    public List<FlowWork> getPaperNumber(String flowDefineCode, String initiator);

    /**
     * 请使用 Example<T> 查询替代该方法
     */
    @Deprecated
    List<FlowWork> getFlowWorks(String flowDefineCode, String flowNodeId,String flowWorkStatus);


    List<FlowWork> findAllByCurrentNodeId(String currentNodeId);

    List<FlowWork> findKycCheck(String flowName,String flowWorkStatus);




}
